package top.wfzzq.dp.prototype;

/**
 * 系統已經完成了淺表克隆的原型模式
 * 
 * 第一步：實現Cloneable接口（標志性接口，不用實現任何方法）
 * 
 * @author wanghui
 *
 */
public class SysPrototype {
	private int pid;
	private String info;

	public SysPrototype() {

	}

	public SysPrototype(int pid, String info) {
		this.pid = pid;
		this.info = info;
	}

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	/**
	 * 第二步，腹瀉父類clone方法，提升可見度即可，不用改寫代碼
	 */

	@Override
	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			return null;
		}
	}

	@Override
	public String toString() {
		return "SysPrototype [pid=" + pid + ", info=" + info + "]";
	}

}
